package pub.controllers;

import org.comet4j.core.CometContext;
import org.comet4j.core.CometEngine;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value="/comet")
public class CometTest {
	@RequestMapping(value="/zero")
	public void zero(){
		CometEngine engine = CometContext.getInstance().getEngine();
		// 参数的意思：通过什么频道（CHANNEL1）发送什么数据（number1++），前台可用可用频道的值（result1）来获取某频道发送的数据
		engine.sendToAll(Comet.CHANNEL1, "0");
		engine.sendToAll(Comet.CHANNEL2, "100");
	}
}
